<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<p>
Should see "baz" centered in its own box, with a two left-aligned lines above, "foo" and "bar".
</p>
<div id="sample" contenteditable>foo<br>bar<br>baz</div>
<div id="log"></div>
<script>
test(function() {
    var selection = window.getSelection();
    var sample = document.getElementById('sample');

    selection.collapse(sample, 4);
    document.execCommand('justifyCenter');

    assert_equals(sample.innerHTML, 'foo<br>bar<br><div style="text-align: center;">baz</div>', 'innerHTML');
    assert_true(selection.isCollapsed, 'isCollapsed');
    assert_equals(selection.anchorNode, sample.childNodes[4].firstChild, 'anchorNode');
    assert_equals(selection.anchorOffset, 0, 'anchorOffset');
});
</script>
